Double the width of static allocations for empty tables #596
+18
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See this discussion here: #578 (comment)
Effectively, the current code will actually need
Group::WIDTH + 1
bytes for an empty table, but we only allocateGroup::WIDTH
bytes for it. This could potentially invoke UB based upon the invariants we set in the table, but because we happen to short-circuit empty tables in just the right ways in the actual code, we never actually trigger it.Since the static allocations are aligned to the group width, we double the size returned, since it would otherwise just add that much extra padding anyway. And since the size of the static allocations added by this is effectively insignificant (8-16 bytes depending on the implementation chosen), it's fair to just do this anyway to make the code more robust.